<template>
  <el-aside
    id="pageSideBar"
    :width="this.$store.state.menu.menuWidth">
    <el-row class="tac">
      <el-col :span="24">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#fff"
          text-color="#878787"
          active-text-color="#499fea"
          :collapse="this.$store.state.menu.menuState"
          :unique-opened="true">
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-s-goods"></i>
              <span>商品管理</span>
            </template>
            <el-menu-item-group>
              <router-link to="/SPUManage">
                <el-menu-item index="1-1">
                  SPU管理
                </el-menu-item>
              </router-link>
              <router-link to="/SKUManage">
                <el-menu-item index="1-2">
                  SKU管理
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-tickets"></i>
              <span>分类管理</span>
            </template>
            <el-menu-item-group>
              <router-link to="/mainType">
                <el-menu-item index="2-1">
                  一级分类管理
                </el-menu-item>
              </router-link>
              <router-link to="/subType">
                <el-menu-item index="2-2">
                  二级分类管理
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-box"></i>
              <span>组合管理</span>
            </template>
            <el-menu-item-group>
              <router-link to="/packageManage">
                <el-menu-item index="3-1">
                  组合列表
                </el-menu-item>
              </router-link>
              <router-link to="/packageAddManage">
                <el-menu-item index="3-2">
                  组合添加
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-tickets"></i>
              <span>交易管理</span>
            </template>
            <el-menu-item-group>
              <router-link to="/orderManege">
                <el-menu-item index="4-1">
                  订单管理
                </el-menu-item>
              </router-link>
              <router-link to="/refund">
                <el-menu-item index="4-2">
                  售后退款
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>
          <router-link to="/userManage"><!--跳转至用户管理组件-->
            <el-menu-item index="5">
              <i class="el-icon-user"></i>
              <span slot="title">用户管理</span>
            </el-menu-item>
          </router-link>

          <router-link to="/designerComponent" v-if="this.$store.state.userInfo.employeeLv!=='门店管理员'">
            <el-menu-item index="6">
              <i class="el-icon-trophy"></i>
              <span slot="title">设计师管理</span>
            </el-menu-item>
          </router-link>

          <el-submenu index="7">
            <template slot="title">
              <i class="el-icon-data-analysis"></i>
              <span>数据统计</span>
            </template>
            <el-menu-item-group>
              <router-link to="/shoppingCartAnalysis">
                <el-menu-item index="7-1">
                  购物车分析
                </el-menu-item>
              </router-link>
              <router-link to="/orderAnalysis">
                <el-menu-item index="7-2">
                  订单分析
                </el-menu-item>
              </router-link>
              <router-link to="/collectionAnalysis">
                <el-menu-item index="7-3">
                  收藏分析
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="8"  v-if="this.$store.state.userInfo.employeeLv==='超级管理员'">
            <template slot="title">
              <i class="el-icon-s-custom"></i>
              <span>管理员</span>
            </template>
            <el-menu-item-group>
              <router-link to="/adminManage">
                <el-menu-item index="8-1">
                  管理员管理
                </el-menu-item>
              </router-link>
              <router-link to="/authorityManage">
                <el-menu-item index="8-2">
                  权限管理
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>

          <router-link to="/logInfo" v-if="this.$store.state.userInfo.employeeLv!=='门店管理员'">
            <el-menu-item index="9">
              <i class="el-icon-s-release"></i>
              <span slot="title">登录日志</span>
            </el-menu-item>
          </router-link>

          <el-menu-item index="10" @click="logOut">
            <i class="el-icon-close"></i>
            <span slot="title">注销登录</span>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </el-aside>
</template>

<script>
export default {
  name: 'sideBar',
  components: {},
  data () {
    return {
      isCollapse: false
    }
  },
  methods: {
    handleOpen (key, keyPath) {
    },
    handleClose (key, keyPath) {
    },
    logOut () {
      this.$store.state.userInfo.isLogged = false
    }
  }
}
</script>

<style scoped lang="less">
  #pageSideBar {
    background-color: #fff;
    min-height: 100vh;

    a:-webkit-any-link {
      color: #878787;
      cursor: pointer;
      text-decoration: none;
    }
  }
</style>
